/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.cs.mailbox.MailItem.Type;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class LockItem
/*    */   extends RedoableOp
/*    */ {
/*    */   protected int id;
/*    */   protected MailItem.Type type;
/*    */   protected String accountId;
/*    */   
/*    */   public LockItem()
/*    */   {
/* 35 */     super(MailboxOperation.LockItem);
/*    */   }
/*    */   
/*    */   public LockItem(int mailboxId, int id, MailItem.Type type, String accountId) {
/* 39 */     this();
/* 40 */     setMailboxId(mailboxId);
/* 41 */     this.id = id;
/* 42 */     this.type = type;
/* 43 */     this.accountId = accountId;
/*    */   }
/*    */   
/*    */   protected String getPrintableData()
/*    */   {
/* 48 */     StringBuffer sb = new StringBuffer("id=").append(this.id);
/* 49 */     sb.append(", type=").append(this.type);
/* 50 */     sb.append(", accountId=").append(this.accountId);
/* 51 */     return sb.toString();
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException
/*    */   {
/* 56 */     out.writeByte(this.type.toByte());
/* 57 */     out.writeUTF(this.accountId);
/* 58 */     out.writeInt(this.id);
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException
/*    */   {
/* 63 */     this.type = MailItem.Type.of(in.readByte());
/* 64 */     this.accountId = in.readUTF();
/* 65 */     this.id = in.readInt();
/*    */   }
/*    */   
/*    */   public void redo() throws Exception
/*    */   {
/* 70 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/* 71 */     mbox.lock(getOperationContext(), this.id, this.type, this.accountId);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/LockItem.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */